﻿@using CoralNode.Core.Entity.Enums
@using CoralNode.MvcClient.Helper
@using Coralcode.Utils.Basic
@model CoralNode.Core.Entity.Domains.Site.SiteDomain

@{
    ViewBag.Title = "Edit";

    if (Model.Status == SiteEnums.SiteStatus.Management) {
        ViewData["Module"] = "system";
    }
}
@Html.IncludePage("CoralAdmin/site", "_Left", new { current = "site" })

<div id="pbody">
    <div class="extra scrolltab">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">站点管理&nbsp;&nbsp;/&nbsp;&nbsp;<b
                class=" t_small f_no">站点信息(@Model.Name)</b></span>
        </div>
        <div id="main">
            <div class="local">
                <a href="/m/site" class="ico ico_back btn"></a>
            </div>
            <div class="content_tab extra_normal">
                @Html.IncludePage("CoralAdmin/site", "_navtab", new { current = "extensioninfo", siteId = Model.Id })
            </div>
            <form id="spform" action="/m/site/editSite/@Model.Id" method="post" enctype="multipart/form-data">
                <div class="">
                    <div class="scrolltab-triggers">
                        @foreach (var group in @ViewBag.SiteExtendGroupList) {
                            <a href="#@group.Title">@group.Title</a>
                        }
                    </div>
                    <div class="pt_3 scrolltab-items">
                        @foreach (var group in @ViewBag.SiteExtendGroupList) {
                            <div class="table_form form_main " id="@group.Title">
                                <div class="scrolltab-item-t">
                                    <span class="btn"></span>@group.Title
                                </div>
                                <div class="pl_2 pb_3">
                                    <table>
                                        <tbody>
                                            @foreach (var item in @group.SiteExtendList) {
                                                <tr>
                                                    <th width="80px">@item.Title</th>
                                                    <td>
                                                        @if (@item.FieldType == SiteEnums.FieldType.TextField) {
                                           
                                                            <input class="text w_37" type="text" name="field.@item.FieldName" validate="@item.Validator" value="@item.Value" />
                                            
                                                            <div class="exp ml_1">@item.Hint</div>
                                                        } else if (@item.FieldType == SiteEnums.FieldType.TextArea) {
                                                            <textarea name="field.@item.FieldName" validate="@item.Validator" class="h_8 w_37">@item.Value</textarea>
                                                            <div class="exp ml_1">@item.Hint</div>
                                                        } else if (@item.FieldType == SiteEnums.FieldType.PasswordField) {
                                                            <input name="field.@item.FieldName" class="text w_37" type="password" validate="@item.Validator" value="@item.Value"/>
                                                            <div class="exp ml_1">@item.Hint</div>
                                      
                                                        } else if (@item.FieldType == NodeEnums.BasicFieldType.FileField) {
                                                            <input type="hidden" validate="@item.Validator" name="field.@item.FieldName" value="@item.Value"/>
                                                            <ul class="list_img" href="/m/common/upload" data-js="listimg">
                                                                <li class="btn li_add js_openuploader" data-meta="{data:'{module:\' @Model.ThemeCode/@item.FieldName\'}',multi:false,method:'add',type:'file'}">
                                                                    <span class="ico ico_upload_file"></span>
                                                                </li>
                                                            </ul>
                                                            <div class="exp ml_1">@item.Hint</div>
                                                        } else if (@item.FieldType == NodeEnums.BasicFieldType.ImageField) {
                                                            <input type="hidden" validate="@item.Validator" name="field.@item.FieldName" value="@item.Value"/>
                                                            <ul class="list_img" href="/m/common/upload" data-js="listimg">
                                                                <li class="btn li_add js_openuploader" data-meta="{data:'{module:\' @Model.ThemeCode/@item.FieldName\'}',multi:false,method:'add',type:'image'}">
                                                                    <span class="ico ico_upload_image"></span>
                                                                </li>
                                                            </ul>
                                                            <div class="exp ml_1">@item.Hint</div>
                                                        } else if (@item.FieldType == NodeEnums.BasicFieldType.MultiImage) {
                                                            <input type="hidden" validate="@item.Validator" name="field.@item.FieldName" value="@item.Value"/>
                                                            <ul class="list_img" href="/m/common/upload" data-js="listimg">
                                                                <li class="btn li_add js_openuploader" data-meta="{data:'{module:\' @Model.ThemeCode/@item.FieldName\'}',multi:true,method:'add',type:'image'}">
                                                                    <span class="ico ico_upload_image"></span>
                                                                </li>
                                                            </ul>
                                                            <div class="exp ml_1">@item.Hint</div>
                                                        } else {
                                                            <textarea name="field.@item.FieldName" id="@item.FieldName" >@item.Value</textarea>
                                                            <script type="text/javascript">
                                                                UE.getEditor('@item.FieldName')
                                                            </script>
                                                            <div class="exp ml_1">@item.Hint</div>
                                                        }
                                                    </td>
                                                </tr>
                                            }
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        }
                    </div>
                    <div class="submitbox p_2 extra_normal">
                        <input type="submit" class="btn_1" value="提    交" />
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $('.nav_left_style2').find('li').eq(0).addClass('current');
    });
</script>
